import Licon from "./Licon.vue";
import "@scss/licon/licon.scss";

let _iconStorage = {};


const init = function() {
    
    // 读取目录下的所有icon--并加入到storage中去
    // 这里我还得弄一个静态资源加载
    const icons = import.meta.globEager("/assets/svg/*.svg");

    for(let x in icons) {
        let p = x;
        x = x.split("/");
        x = x[x.length-1];
        x = x.split(".")[0];
        _iconStorage[x] = icons[p].default;
    }

    Licon.props["_iconStorage"] = {
        type: Object,
        default: _iconStorage
    }
}

Licon.install = function(app) {
    init(app);
    app.component("Licon",Licon);
}

export default Licon;